<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,viewport-fit=cover,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
    <title>个人中心</title>
    <script src="js/rem.js"></script>
    <link rel="stylesheet" href="css/weui.min.css">
    <link rel="stylesheet" href="css/jquery-weui.min.css">
    <link rel="stylesheet" href="css/public.css">
    <link rel="stylesheet" href="css/user.css">
    <script>(function() {var _53code = document.createElement("script");_53code.src = "https://tb.53kf.com/code/code/96d8f960b261e49515450f8953b044bc5/1";var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(_53code, s);})();</script>
</head>
<body>
    <div class="pub_bar" title="尤迈桃李会" left="back"></div>
    <!--  -->
    <div class="user">
        <div class="pub-container has-tabbar2">
            <!-- 用户 - 顶部 -->
            <header class="header">
                <a id="authResult" href="javascript:;"><img class="auth-btn" src="image/user-auth-btn.png" alt=""></a>
                <div class="userinfo plr15">
                    <img class="avatar j_avatar" src="" alt="">
                    <div class="info">
                        <p class="name" id="userName">用户名</p>
                        <p class="integral">积分<span>0</span></p>
                    </div>
                </div>
                <ul class="user-navs">
                    <li class="subscribe" data-url="">
                        <a href="javascript:;"><span class="txt">收藏</span><span class="num">0</span></a>
                    </li>
                    <li class="support" data-url="">
                        <a href="javascript:;"><span class="txt">点赞</span><span class="num">0</span></a>
                    </li>
                    <li class="course" data-url="">
                        <a href="javascript:;"><span class="txt">课程</span><span class="num">0</span></a>
                    </li>
                    <li class="consultation" id="toList">
                        <a href="javascript:;"><span class="txt">会诊</span><span class="num">0</span></a>
                    </li>
                    <li class="classroom" data-url="">
                        <a href="javascript:;"><span class="txt">培训</span><span class="num">0</span></a>
                    </li>
                </ul>
            </header>
            <div class="user-jxs plr15">
                <h2>我的讲习所</h2>
                <ul class="jxs-navs">
                    <li class="jxs-mall" data-url="">
                        <a href="javascript:;">积分商城</a>
                    </li>
                    <li class="jxs-invite" data-url="user-share.html">
                        <a href="javascript:;">我的邀请</a>
                    </li>
                    <li class="jxs-bag" data-url="">
                        <a href="javascript:;">我的钱包</a>
                    </li>
                    <li class="jxs-custom" data-url="">
                        <a href="javascript:;">在线客服</a>
                    </li>
                    <li class="jxs-card" data-url="user-auth-result.html">
                        <a href="javascript:;">我的身份</a>
                    </li>
                    <li class="jxs-setting" data-url="user-setting.html">
                        <a href="javascript:;">账户设置</a>
                    </li>
                    <li class="jxs-course" data-url="ot-myClass.html">
                        <a href="javascript:;">我的课程</a>
                    </li>
                </ul>
            </div>
            <!-- 公共footer -->
            <div class="pub-footer">
                <ul class="tabs">
                    <li class="tab-classroom"><a href="./ot-classroom-index.html">首页</a></li>
                    <li class="tab-doctor"><a href="./ot-doctor-index.html">名医</a></li>
                    <li class="tab-curriculum"><a href="./ot-curriculum-index.html">课程</a></li>
                    <li class="tab-forum"><a href="./classroom-index.html">讲堂</a></li>
                    <li class="tab-consultation"><a href="consultation-index.html">会诊</a></li>
                    <li class="tab-user active"><a href="user.html">我的</a></li>
                </ul>
            </div>
        </div>
    </div>
    <script src="js/jquery-3.6.0.min.js"></script>
    <script src="js/jquery-weui.min.js"></script>
    <script src="js/md5.js"></script>
    <script src="js/public.js"></script>
    <script>
        $('.user-navs li').click(function(){
            var url = $(this).attr('data-url');
            if(url){
                window.location.href = url;
            }
        })
        $('.jxs-navs li').click(function(){
            var url = $(this).attr('data-url');
            if(url){
                window.location.href = url;
            }
        })
        var userId = getCookie('userId');
        // 查询我的认证
        queryMes();
        function queryMes(){
            http('/userMessage/getMyMessage', {
                loading: true,
                hasToken: true,
                success: function(res){
                    if(res.code === '01'){
                        var data = res.data;
                        var url = (data.roleId === '4' && data.auditStatus === '2') ? 'user-consul-dlist.html' : 'user-consul-clist.html';
                        var head = data.head || 'image/share-avatar.png';
                        $('.j_avatar').attr('src', head);
                        $('#toList').attr('data-url', url);
                        $('#userName').html(data.userName || '用户名');
                        $('#authResult').attr('href', 'user-auth-result.html');
                        $('.jxs-card').attr('data-url', 'user-auth-result.html');
                    }else if(res.code === '04') {
                        $('#toList').attr('data-url', 'user-consul-clist.html');
                        $('#authResult').attr('href', 'user-auth-index.html')
                        $('.jxs-card').attr('data-url', '');
                        $('.j_avatar').attr('src', avatar);
                    }
                }
            })
        }
        
        if(userId){
            queryHzNum();
            querySubsNum();
            queryCourseNum();
        }
        // 查询会诊数量
        function queryHzNum(){
            http('/consulation/countConsult', {
                hasToken: false,
                data: {
                    userId: userId
                },
                success: function(res){
                    if(res.code === '01'){
                        $('.consultation .num').html(res.data);
                    }
                }
            })
        }
        // 查询会诊数量
        function querySubsNum(){
            http('/consulation/countGood', {
                hasToken: false,
                data: {
                    userId: userId
                },
                success: function(res){
                    if(res.code === '01'){
                        $('.support .num').html(res.data);
                    }
                }
            })
        }
        // 查询课程数量
        function queryCourseNum(){
            http('/consulation/countReserve', {
                hasToken: false,
                data: {
                    userId: userId
                },
                success: function(res){
                    if(res.code === '01'){
                        $('.course .num').html(res.data);
                    }
                }
            })
        }
    </script>
</body>
</html>